package main

import (
	"fmt"

	"github.com/astaxie/beego"
)

type RequestController struct {
	beego.Controller
}

func (c *RequestController) Header() {
	ctx := c.Ctx
	input := ctx.Input

	// 上传文件
	_, header, err := c.GetFile("x")
	fmt.Println(header, err)
	// io.Copy(os.Stdout, file)

	c.SaveToFile("x", "x.txt")
	fmt.Println(string(input.CopyBody(1024 * 1024)))
	ctx.Output.Body([]byte("header"))
}

func main() {
	beego.AutoRouter(&RequestController{})
	beego.Run(":19999")
}
